#!/bin/bash
xdebug_path="/data/logs_bak/xdebug";
if [ -e $xdebug_path ]; then
    cd /data/logs_bak/xdebug;
    find -type f -name "*.tar.gz" -mtime +5|xargs rm -rf {}\;
    cd "`date +%Y%m%d`"
    for i in $(find ./ -type d);  do
         if [ ${#i} -gt 4 ];
         then
            tar zcvf $i.tar.gz $i;
            rm -rf $i ;
         fi
    done
fi